import { call, put, take } from 'redux-saga/effects'
import { getCodeTopic } from "../api/index";

//同步获取数据
const setCnodeDataList = (data) => ({
    type: "setCnodeDataList",
    data,
  });

function *getCnodeTopicAsync() {
    while(true){
        yield take('setCnodeDataListSaga');
        console.log("使用saga");
        const res = yield call(getCodeTopic)
        console.log(res.data.data);
        yield put(setCnodeDataList(res.data.data))
    }
}

export default getCnodeTopicAsync